" Vim syntax file
" Language:	Pascal
" Maintainer for original:	Mario Eusebio <bio@dq.fct.unl.pt>
" Maintainer for variant:	John L. Spetz <jls11@po.cwru.edu>
" Last change:	1997 April 25

" Remove any old syntax stuff hanging around
syn clear

syn case ignore

syn keyword pascalStatement		program begin end
" //Add a few for Turbo Pascal unit syntax
syn keyword pascalStatement		unit uses interface implementation
syn keyword pascalLabel		case goto
syn keyword pascalConditional	if else then
syn keyword pascalRepeat		do for while to until repeat

syn keyword pascalTodo contained	TODO

" String
syn region  pascalString	start=+'+  end=+'+

"syn match  pascalIdentifier		"\<\h\w*\>"

"syn match  pascalDelimiter		"[()]"

syn match  pascalMatrixDelimiter	"[][]"

"if you prefer you can highlight the range
"syn match  pascalMatrixDelimiter	"[\d\+\.\.\d\+]"

"syn match  pascalNumber		"-\=\<\d\+\.\d\+[dD]-\=\d\+\>"
"syn match  pascalNumber		"-\=\<\d\+\.\d\+[eE]-\=\d\+\>"
"syn match  pascalNumber		"-\=\<\d\+\.\d\+\>"
syn match  pascalNumber		"-\=\<\d\+\>"
syn match  pascalByte		"\$\x\+\>"
syn keyword  pascalSpecialConstant         true false nil

" If you don't like tabs
"syn match pascalShowTab "\t"
"syn match pascalShowTabc "\t"

syn region pascalComment	start="(\*"  end="\*)" contains=pascalTodo
syn region pascalComment	start="{"  end="}" contains=pascalTodo

syn keyword pascalOperator	and delete div downto
syn keyword pascalOperator	get in input insert
syn keyword pascalOperator	interactive keyboard maxint
syn keyword pascalOperator	mod new not of or output packed
syn keyword pascalOperator	put read readln record 
syn keyword pascalOperator	reset rewrite seek 
syn keyword pascalOperator	with write writeln
" //Add some more operator patterns for Turbo Pascal and Delphi  --JLS
syn keyword pascalOperator	xor shl shr
syn keyword pascalOperator	chr ord succ pred sizeof 

syn keyword pascalType	char const integer real text
syn keyword pascalType	var type string
syn keyword pascalType	file label
" //Add some more type patterns for Turbo Pascal and Delphi  --JLS
syn keyword pascalType	boolean byte shortint word longint
syn keyword pascalType	smallint
syn keyword pascalType	double extended
" syn keyword pascalType	comp
" //There are a lot of false matches for Comp so only match it in defs.
syn match pascalType	"\s*:\s*comp\>"hs=e-4
syn keyword pascalType	set array
syn keyword pascalType	virtual asm far object absolute private

syn keyword pascalFunction	procedure function
syn keyword pascalFunction	constructor destructor

syn sync lines=250

if !exists("did_pascal_syntax_inits")
  let did_pascal_syntax_inits = 1
  " The default methods for highlighting.  Can be overridden later
  hi link pascalStatement		Statement
  hi link pascalLabel			Label
  hi link pascalConditional		Conditional
  hi link pascalRepeat			Repeat
  hi link pascalTodo			Todo
  hi link pascalString			String
  hi link pascalMatrixDelimiter		Identifier
  hi link pascalNumber			Number
  hi link pascalByte			Number
  hi link pascalOperator		Operator
  hi link pascalFunction		Function
  hi link pascalType			Type
  hi link pascalComment			Comment
  hi link pascalStatement		Statement
  hi link pascalPreCondit	        PreCondit
  hi link pascalSpecialConstant         Constant

"optional highlighting
  "hi link pascalDelimiter		Identifier

  "hi link pascalShowTab			Error
  "hi link pascalShowTabc		Error

  "hi link pascalIdentifier		Identifier
endif

let b:current_syntax = "tpascal"

" vim: ts=8
